package com.agann.util;

import com.agann.model.Memory;
import com.agann.model.Record;

public class EMA extends Memory {
	/**
	 * Type Code
	 */
	public static final String TYPE_CODE = "EMA";
	public static final String EMA_SCORE = "ema_score";
	
	private int n;
	private EMA_Util ema;
	
	public EMA(String code) {
		super(code);
		//TODO Add Exception Check
		String[] args = code.split("@");
		n = Integer.valueOf(args[1]);
		ema = new EMA_Util(n);
	}
	
	
	@Override
	public void update(Record record) {
		ema.update(record.getClose());
		setScore(EMA_SCORE, ema.getScore());
	}


	@Override
	public void merge(String code) {
		// TODO Auto-generated method stub
		
	}


	@Override
	public void change(double rate) {
		// TODO Auto-generated method stub
		
	}

}
